<head>
<?php $this->load->view('head'); ?>
</head>
<div id="wrapper">
	<div id="content-container">
        <div id="content-main">
	       <div class="content-auto">
        <?php
            if(is_array($items) && count($items) ) {
            $i=1;
            ?>
            <table>
                 <thead>
                        <tr>
                            <td style="border:0" align="left" colspan="2">
                                    <span class='textunderline_blue_titlerpt'>CHAMROEUN&nbsp;Microfinance&nbsp;Limited
                                    <br />
                                    </span><br /><br />
                                    <strong><?php echo $title; ?></strong><br />
                                    <strong>Office: <?php echo $xlbranch;?></strong><br />
                            </td>
                       </tr>
                </thead>
            </table>
            <table class="table table-bordered table-striped" cellspacing="0" cellpadding="0" border="1">
            	  <thead>
            	    <tr>
                        <th><strong>#</strong></th>
                        <th><strong>Purchased Date</strong></th>
                        <th><strong>Item</strong></th>
                        <th><strong>Unit</strong></th>
                        <th><strong>CPU</strong></th>
                        <th><strong>Total</strong></th>
                        <th><strong>Status</strong></th>
                        <th class="remark"><strong>Remark</strong></th>
            	    </tr>
            	  </thead>
            	  <tbody>
              	<?php 
            		foreach ($items as $item){
            			echo "<tr class='first' valign='top'>\n";
                        echo "<td align='center'>".$i++."</td>\n";
                        echo "<td align='center'>".date("d-m-Y (D)", strtotime($item->datepurchased))."</td>\n";
            			echo "<td align='center'>".$item->item."</td>\n";
                        echo "<td align='center'>".$item->unit."</td>\n";
                        echo "<td align='center'>".$item->cpu."</td>\n";
                        echo "<td align='center'>".$item->total."</td>\n";
                        echo "<td align='center'>Broken</td>\n";
                        echo "<td align='center'>".$item->remark."</td>\n";
            			echo "</tr>\n";
            		}
              	?>
              </tbody>
            </table>
        <?php }?>
            </div>
	   </div>
	</div>
</div>
<?php 
    $filename=$xlname.'_'.date('Ymdhis', time()).".xls";
	header('Content-type: application/vnd.ms-excel');
    header("Content-Disposition: attachment; filename=$filename");
    header("Pragma: no-cache");
    header("Expires: 0");
?>
